package ipad.asia.service.shop;

import ipad.asia.entity.Shop;
import ipad.asia.service.shop.fallback.ShopFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@FeignClient(value = "PROVIDER-ENTERPRISE")
public interface ShopFeign {
    /**
     * 根据id查找店铺，用于聊天中的咨询商家
     * @param id
     * @return
     */
    @RequestMapping("/shop/getById")
     Shop findById(@RequestParam(value = "id",required = false) int id) ;

    /**
     * 根据模糊搜索店铺名查找店铺，用于顾客
     * @param name
     * @return
     */
    @PostMapping("/shop/getByName/{name}")
     Shop findByNameLike(@PathVariable(value = "name",required = false) String name) ;

    /**
     * 根据产品id查找店铺，用于商品详情
     * @param id
     * @return
     */
    @PostMapping("/shop/getByProductId")
     Shop findByProductId(@RequestParam(value = "id") int id);

    /**
     * 根据商家id查找店铺，用于商家
     * @param id
     * @return
     */
    @PostMapping("/shop/getByEnterpriseId")
     Shop findByEnterpriseId(@RequestParam(value = "int") int id) ;
}
